//
//  StatusCell.swift
//  微博项目
//
//  Created by mac on 16/1/18.
//  Copyright © 2016年 mac. All rights reserved.
//

import UIKit
import SnapKit

class StatusCell: UITableViewCell {
    
    var status:Status?{
        
        didSet{
            //绑定数据
            //设置原创微博的数据模型
            statusOriginalView.status = status
        }
    }
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupUI(){
        
        backgroundColor = UIColor.yellowColor()
        // self.addSubview(statusOriginalView)
        contentView.addSubview(statusOriginalView)
        
        //设置约束
        statusOriginalView.snp_makeConstraints { (make) -> Void in
            make.top.left.right.equalTo(self.contentView)
//            make.top.equalTo(self.contentView.snp_top)
//            make.left.equalTo(self.contentView.snp_left)
//            make.right.equalTo(self.contentView.snp_right)
        }
        
        //给contenView设置约束条件
        contentView.snp_makeConstraints { (make) -> Void in
            make.left.right.top.equalTo(self)
            //自动计算行高的最关键的一条约束
            make.bottom.equalTo(statusOriginalView.snp_bottom)
        }
        
        
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    
    override func setSelected(selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        
        // Configure the view for the selected state
    }
    
    //懒加载子视图
    private lazy var statusOriginalView: StatusOriginalView = StatusOriginalView()
    
}
